package com.stone.serviceimpl;

import com.stone.daoimpl.ProjectDao;
import com.stone.model.Project;
import com.stone.service.IProjectService;
import com.stone.utils.Page;

public class ProjectService implements IProjectService {

	private ProjectDao projectDao;
	/*getter setter*/
	public ProjectDao getProjectDao() {
		return projectDao;
	}

	public void setProjectDao(ProjectDao projectDao) {
		this.projectDao = projectDao;
	}

	public Project addProject(Project project) {
		return projectDao.save(project);
	}

	public void deleteProject(Project project) {
		projectDao.delete(project);
	}
	public void updateProject(Project project) {
		projectDao.update(project);
	}

	public Project findProjectById(Long projectId) {
		return projectDao.findById(projectId);
	}
	
	public Page findAllProject(int pageNo, int pageSize) {
		return projectDao.findAllProjects(pageNo, pageSize);
	}

	public Page getProjectOrderByTitle(int pageno, int pagesize) {
		return projectDao.findProjectOrderByTitle(pageno, pagesize);
	}

	public Page searchProjectOrderByTitle(String title, int pageno, int pagesize) {
		return projectDao.searchProjectOrderByTitle(title, pageno, pagesize);
	}
}